﻿using Microsoft.Xaml.Behaviors;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;

namespace SharpSoft.WPF.Behaviors
{
    public class TouchGestureBehavior : Behavior<UIElement>
    {
        protected override void OnAttached()
        {
            base.OnAttached();
            this.AssociatedObject.AddHandler(UIElement.TouchDownEvent, new EventHandler<TouchEventArgs>(this.TouchDown), false);
            this.AssociatedObject.AddHandler(UIElement.TouchMoveEvent, new EventHandler<TouchEventArgs>(this.TouchMove), false);
            this.AssociatedObject.AddHandler(UIElement.TouchUpEvent, new EventHandler<TouchEventArgs>(this.TouchUp), false);
            this.AssociatedObject.AddHandler(UIElement.TouchEnterEvent, new EventHandler<TouchEventArgs>(this.TouchEnter), false);
            this.AssociatedObject.AddHandler(UIElement.TouchLeaveEvent, new EventHandler<TouchEventArgs>(this.TouchLeave), false);
            this.AssociatedObject.AddHandler(UIElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(this.MouseLeftButtonDown), false);

        }

        private void MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (e.StylusDevice!=null)
            {

            }
        }

        private void TouchLeave(object sender, TouchEventArgs e)
        {
        }

        private void TouchEnter(object sender, TouchEventArgs e)
        {
        }

        private void TouchUp(object sender, TouchEventArgs e)
        {
        }

        private void TouchMove(object sender, TouchEventArgs e)
        {
        }

        private void TouchDown(object sender, TouchEventArgs e)
        {
            var d = e.Device;
        }
    }
}
